package storeMovie.Util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class SessionFactoryUtil {
	private static final SessionFactory SESSION_FACTORY;
	//private static Session SESSION;
	static {
		try {
			SESSION_FACTORY = new Configuration().configure()
					.buildSessionFactory();
		} catch (Exception ex) {
			System.err.println("Initial SessionFactory creation failed." + ex);
			throw new ExceptionInInitializerError(ex);
		}
	}

	public static SessionFactory getSessionFactory() {
		return SESSION_FACTORY;
	}
	
	
	//public static Session openSession() {
	//	SESSION = SessionFactoryUtil.getSessionFactory().getCurrentSession();
	//	return SESSION;
	//}
}
